<ix-modal-header
  [requiredRoles]="requiredRoles"
  [title]="title"
  [loading]="isLoading()"
></ix-modal-header>

<mat-card>
  <mat-card-content>
    <form class="ix-form-container" [formGroup]="form" (submit)="onSubmit()">
      <ix-fieldset [title]="'Authentication Method and Group' | translate">
        <ix-input
          formControlName="tag"
          type="number"
          [label]="'Group ID' | translate"
          [tooltip]="tooltips.tag | translate"
          [required]="true"
        ></ix-input>

        <ix-select
          formControlName="discovery_auth"
          [label]="'Discovery Authentication' | translate"
          [tooltip]="tooltips.discovery_auth | translate"
          [options]="discoveryAuthOptions$"
          [required]="true"
        ></ix-select>
      </ix-fieldset>

      <ix-fieldset [title]="'User' | translate">
        <ix-input
          formControlName="user"
          [label]="'User' | translate"
          [required]="true"
          [tooltip]="tooltips.user | translate"
        ></ix-input>

        <ix-input
          formControlName="secret"
          type="password"
          [label]="'Secret' | translate"
          [required]="true"
          [tooltip]="tooltips.secret | translate"
        ></ix-input>

        <ix-input
          formControlName="secret_confirm"
          type="password"
          [label]="'Secret (Confirm)' | translate"
          [required]="true"
        ></ix-input>
      </ix-fieldset>

      <ix-fieldset [title]="'Peer User' | translate">
        <ix-input
          formControlName="peeruser"
          [label]="'Peer User' | translate"
          [tooltip]="tooltips.peeruser | translate"
        ></ix-input>

        <ix-input
          formControlName="peersecret"
          type="password"
          [label]="'Peer Secret' | translate"
          [required]="isPeerUserSet()"
          [tooltip]="tooltips.peersecret | translate"
        ></ix-input>

        <ix-input
          formControlName="peersecret_confirm"
          type="password"
          [label]="'Peer Secret (Confirm)' | translate"
          [required]="isPeerUserSet()"
        ></ix-input>
      </ix-fieldset>

      <ix-form-actions>
        <button
          *ixRequiresRoles="requiredRoles"
          mat-button
          type="submit"
          color="primary"
          ixTest="save"
          [disabled]="form.invalid || isLoading()"
        >
          {{ 'Save' | translate }}
        </button>
      </ix-form-actions>
    </form>
  </mat-card-content>
</mat-card>
